<template>
	<view class="vux-1px-b m-cell-item-c" hover-class="opacity-hover" @tap="handleTapCell">
		<view class="l">
			<view class="icon" :class="[option.iconfontClass||'m-iconfont']" v-if="!option.iconSlot&&option.iconCode"
				v-html="option.iconCode"></view>
			<view class="icon" v-if="option.iconSlot">
				<slot name="icon"></slot>
			</view>
			<view class="label">
				{{option.label}}
			</view>
		</view>
		<view class="r">
			<view class="value" v-if="option.value">
				{{option.value}}
			</view>
			<view class="m-iconfont icon-right" v-if="option.arrow!==false">
				&#xe63e;
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "m-cell-item",
		props: {
			option: {
				type: Object,
				default: () => {
					return {}
				}
			},
		},
		methods: {
			handleTapCell() {
				const option = this.option
				if (option.pageUrl) {
					this.$m.navigateTo(option.pageUrl)
				} else {
					this.$emit('click', this.option)
				}
			}
		},
	}
</script>

<style lang="scss" scoped>
	.m-cell-item-c {
		height: 100rpx;
		display: flex;
		background-color: #FFFFFF;
		align-items: center;
		justify-content: space-between;
		padding: 0 30rpx;

		.l,
		.r {
			line-height: 1;
			display: flex;
			align-items: center;

			.icon {
				font-size: 28rpx;
				color: #333333;
				padding-right: 10rpx;
			}

			.label {
				font-size: 28rpx;
				font-weight: 500;
				color: #333333;
			}

			.value {
				font-size: 28rpx;
				font-weight: 500;
				color: #333333;
				// line-height: 0;
			}

			.icon-right {
				padding-left: 10rpx;
				font-size: 24rpx;
				color: #999;
			}
		}
	}
</style>
